package edu.zut.cs.software.cms.module.attendance.dao;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import edu.zut.cs.software.cms.base.dao.GenericDao;
import edu.zut.cs.software.cms.module.attendance.domain.Attendance;

/**
 * 
 * @author 清风依旧
 *
 */
public interface AttendanceDao extends GenericDao<Attendance, Long>{	
	@Query(value="  SELECT * FROM `cms`.`t_attendance` WHERE `id`=?1 ",nativeQuery=true)
	Attendance modifyById(@Param("id") long id);		
	
	/**
	 * 返回Attendance实体的全部数据
	 * @return
	 */
	@Query(value="  SELECT * FROM `cms`.`t_attendance` ",nativeQuery=true)
	List<Attendance> selectAttendances();
	
	@Query(value="  SELECT COUNT(*) FROM `cms`.`t_attendance` WHERE `name`=?1 ",nativeQuery=true)
	int IfOneExist(@Param("name") String name);
}
